package com.yykj.tencent.im.server.converter;

import com.yykj.tencent.im.server.dto.C2CMessageDTO;
import com.yykj.tencent.im.server.model.entity.C2CMessage;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

public class C2CMessageConverter {
    public static C2CMessageDTO convert(C2CMessage item){
        C2CMessageDTO dto = new C2CMessageDTO();
        BeanUtils.copyProperties(item,dto);
        return dto;
    }

    public static List<C2CMessageDTO> convert(List<C2CMessage> list){
        return list.stream().map(C2CMessageConverter::convert).collect(Collectors.toList());
    }
}
